package org.project.d.network.msg.serializer;

import com.alibaba.fastjson.JSONObject;

/**
 * @author lin
 * @version V1.0
 * @description
 * @date 2020/6/12 12:12 下午
 */
public class JsonSerialization implements Serialization {


    @Override
    public byte[] serialized(Object object) {
        //  json序列化
        return JSONObject.toJSONBytes(object);
    }

    @Override
    public <T> T deserialized(byte[] body, Class<T> tClass) {
        return JSONObject.parseObject(new String(body), tClass);
    }


}
